include "SurveyItem.thrift"
namespace java com.vng.zing.survey.thrift.service
namespace cpp  com.vng.zing.survey.thrift.service

service SurveyService{
	////////////////////////////////////////////////
         /////////////////// write /////////////////////
	////////////////////////////////////////////////
        // save a new survey return ID, return erro code
	SurveyItem.IDSurveyResult newSurvey(1: SurveyItem.IDUser idUser,2: SurveyItem.SurveyItem surveyItem),

	// save a new response return erro code,
	SurveyItem.Error newResponse(1: SurveyItem.IDUser idUser,2:SurveyItem.IDSurvey idSurvey,3: SurveyItem.Response response),

	// edit a exits survey return erro code
	SurveyItem.Error updateSurvey(1: SurveyItem.IDSurvey idSurvey, 2: SurveyItem.SurveyItem surveyItem),


	///////////////////////////////////////////////////////
	/////////////  read  //////////////////////////////////
	////////////////////////////////////////////////////////

	//get list short infor of survey with key IDUser(admin fanpage)
	 list<SurveyItem.ShortInfoSurveyItem> getListShortInfoSurveyItem(1:SurveyItem.IDUser idUser, 2: i32 page),
	// get a surveyItem with key IDSurvey
	SurveyItem.SurveyItemResult getSurvey(1:SurveyItem.IDSurvey idSurvey),

	// get count survey of Fan Page with key IDUser
	i32 getCountSurvey(1:SurveyItem.IDUser idUser),

	// get a response with key IDSurvey and IDUser
	list<SurveyItem.AnswerItem>  getResponse(1:SurveyItem.IDSurvey idSurvey,2:SurveyItem.IDUser idUser),

	//get count response of survey
	i32 getCountResponse(1:SurveyItem.IDSurvey idSurvey),
	// get lis response with page
	list<SurveyItem.Response> getListResponse(1:SurveyItem.IDSurvey idSurvey, 2: i32 page),

	SurveyItem.State checkUser(1:SurveyItem.IDSurvey idSurvey,2:SurveyItem.IDUser idUser)

	//////////////////////////////////////////////////////////////	
	/////////////// delete //////////////////////////////////////
	////////////////////////////////////////////////////////////
	// remove a exits survey with key IDSurvey return erro code
	SurveyItem.Error removeSurveyItem(1: SurveyItem.IDSurvey idSurvey),

	// remove a list exits survey with key IDSurvey return erro code
	list<SurveyItem.Error> removeListSurveyItem(1: list<SurveyItem.IDSurvey> idSurveys),

	// remove a exits response with key IDSurvey and IDUser return erro code
	SurveyItem.Error removeResponse (1:SurveyItem.IDSurvey idSurvey,2: SurveyItem.IDUser idUser),

	// remove a list exits response with key IDSurvey and IDUser return erro code
	SurveyItem.Error removeListResponse (1: list<SurveyItem.ResponseKey> responseKey),
	
	string getStat(1:i32 type),

}
